package base;

import finalizer.TestFinalizer;
import initializer.SuiteInitializer;
import initializer.TestInitializer;

import org.openqa.selenium.WebDriver;

public class BaseScript {
        protected static WebDriver driver;
        protected static boolean flagInSuite = false;
       
          public void initTest() {
                  if (driver == null)
                  {
                          if (flagInSuite)
                          {
                                  driver = SuiteInitializer.getDriver();
                          }
                          else
                          {
                                  TestInitializer.startHomepage();
                                  driver = TestInitializer.getDriver();
                          }
                  }
          }
       
       
        public void finalizeTest() {
                  if (!flagInSuite)
                          TestFinalizer.closeBrowser();
        }
       
        public static void setSuiteFlag(boolean flag)
        {
                flagInSuite = flag;
        }

}

